In [3]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
In [4]:
games = pd.read_csv("vgsales.csv")
games.shape
Out[4]:
(16598, 11)
In [5]:
games.count()
Out[5]:
Rank            16598
Name            16598
Platform        16598
Year            16327
Genre           16598
Publisher       16540
NA_Sales        16598
EU_Sales        16598
JP_Sales        16598
Other_Sales     16598
Global_Sales    16598
dtype: int64
In [6]:
games.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 16598 entries, 0 to 16597
Data columns (total 11 columns):
 #   Column        Non-Null Count  Dtype  
---  ------        --------------  -----  
 0   Rank          16598 non-null  int64  
 1   Name          16598 non-null  object 
 2   Platform      16598 non-null  object 
 3   Year          16327 non-null  float64
 4   Genre         16598 non-null  object 
 5   Publisher     16540 non-null  object 
 6   NA_Sales      16598 non-null  float64
 7   EU_Sales      16598 non-null  float64
 8   JP_Sales      16598 non-null  float64
 9   Other_Sales   16598 non-null  float64
 10  Global_Sales  16598 non-null  float64
dtypes: float64(6), int64(1), object(4)
memory usage: 1.4+ MB
In [7]:
games
Out[7]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
0 1 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
1 2 Super Mario Bros. NES 1985.0 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37
... ... ... ... ... ... ... ... ... ... ... ...
16593 16596 Woody Woodpecker in Crazy Castle 5 GBA 2002.0 Platform Kemco 0.01 0.00 0.00 0.00 0.01
16594 16597 Men in Black II: Alien Escape GC 2003.0 Shooter Infogrames 0.01 0.00 0.00 0.00 0.01
16595 16598 SCORE International Baja 1000: The Official Game PS2 2008.0 Racing Activision 0.00 0.00 0.00 0.00 0.01
16596 16599 Know How 2 DS 2010.0 Puzzle 7G//AMES 0.00 0.01 0.00 0.00 0.01
16597 16600 Spirits & Spells GBA 2003.0 Platform Wanadoo 0.01 0.00 0.00 0.00 0.01

16598 rows × 11 columns

In [8]:
platforms = games["Platform"].unique()
platforms
Out[8]:
array(['Wii', 'NES', 'GB', 'DS', 'X360', 'PS3', 'PS2', 'SNES', 'GBA',
       '3DS', 'PS4', 'N64', 'PS', 'XB', 'PC', '2600', 'PSP', 'XOne', 'GC',
       'WiiU', 'GEN', 'DC', 'PSV', 'SAT', 'SCD', 'WS', 'NG', 'TG16',
       '3DO', 'GG', 'PCFX'], dtype=object)
In [9]:
genres = games["Genre"].unique()
genres
Out[9]:
array(['Sports', 'Platform', 'Racing', 'Role-Playing', 'Puzzle', 'Misc',
       'Shooter', 'Simulation', 'Action', 'Fighting', 'Adventure',
       'Strategy'], dtype=object)
In [10]:
publishers = games["Publisher"].unique()
publishers.shape
Out[10]:
(579,)
In [11]:
games.describe()
Out[11]:
Rank Year NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
count 16598.000000 16327.000000 16598.000000 16598.000000 16598.000000 16598.000000 16598.000000
mean 8300.605254 2006.406443 0.264667 0.146652 0.077782 0.048063 0.537441
std 4791.853933 5.828981 0.816683 0.505351 0.309291 0.188588 1.555028
min 1.000000 1980.000000 0.000000 0.000000 0.000000 0.000000 0.010000
25% 4151.250000 2003.000000 0.000000 0.000000 0.000000 0.000000 0.060000
50% 8300.500000 2007.000000 0.080000 0.020000 0.000000 0.010000 0.170000
75% 12449.750000 2010.000000 0.240000 0.110000 0.040000 0.040000 0.470000
max 16600.000000 2020.000000 41.490000 29.020000 10.220000 10.570000 82.740000
In [12]:
platform_count = []
for p in platforms:
    condition = games[games.Platform == p]
    platform_count.append(condition["Platform"].count())
    
plt.pie(platform_count, labels=platforms, 
        shadow=True, startangle=600)
#plt.legend(platforms, loc=2)
#autopct='%1.1f%%',
plt.show()
In [13]:
print(platforms)
print(platform_count)
['Wii' 'NES' 'GB' 'DS' 'X360' 'PS3' 'PS2' 'SNES' 'GBA' '3DS' 'PS4' 'N64'
 'PS' 'XB' 'PC' '2600' 'PSP' 'XOne' 'GC' 'WiiU' 'GEN' 'DC' 'PSV' 'SAT'
 'SCD' 'WS' 'NG' 'TG16' '3DO' 'GG' 'PCFX']
[1325, 98, 98, 2163, 1265, 1329, 2161, 239, 822, 509, 336, 319, 1196, 824, 960, 133, 1213, 213, 556, 143, 27, 52, 413, 173, 6, 6, 12, 2, 3, 1, 1]
In [14]:
games.loc[:, ["Rank", "Name"]]
Out[14]:
Rank Name
0 1 Wii Sports
1 2 Super Mario Bros.
2 3 Mario Kart Wii
3 4 Wii Sports Resort
4 5 Pokemon Red/Pokemon Blue
... ... ...
16593 16596 Woody Woodpecker in Crazy Castle 5
16594 16597 Men in Black II: Alien Escape
16595 16598 SCORE International Baja 1000: The Official Game
16596 16599 Know How 2
16597 16600 Spirits & Spells

16598 rows × 2 columns

In [15]:
games.boxplot()
plt.show()
In [16]:
million = pow(10,6)
sales = games.loc[:, ["NA_Sales", "EU_Sales", "JP_Sales", "Other_Sales"]]*million
sales.boxplot()
plt.show()
In [17]:
globall = games.loc[:,["Global_Sales"]]*million
globall.boxplot()
plt.show()
In [18]:
all_sales = games.loc[:, ["NA_Sales", "EU_Sales", "JP_Sales", "Other_Sales"]]
sns.heatmap(all_sales.corr(), annot=True)
plt.show()
In [19]:
data = games.drop(["Rank"], axis=1)
data
Out[19]:
Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
0 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
1 Super Mario Bros. NES 1985.0 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
2 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
3 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
4 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37
... ... ... ... ... ... ... ... ... ... ...
16593 Woody Woodpecker in Crazy Castle 5 GBA 2002.0 Platform Kemco 0.01 0.00 0.00 0.00 0.01
16594 Men in Black II: Alien Escape GC 2003.0 Shooter Infogrames 0.01 0.00 0.00 0.00 0.01
16595 SCORE International Baja 1000: The Official Game PS2 2008.0 Racing Activision 0.00 0.00 0.00 0.00 0.01
16596 Know How 2 DS 2010.0 Puzzle 7G//AMES 0.00 0.01 0.00 0.00 0.01
16597 Spirits & Spells GBA 2003.0 Platform Wanadoo 0.01 0.00 0.00 0.00 0.01

16598 rows × 10 columns

In [20]:
games[games.JP_Sales == games["JP_Sales"].max()]
Out[20]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.0 31.37

Pokémon Red & Blue (Türkçe: Pokémon Kırmızı ve Mavi), ilk olarak 1996 yılının ilk çeyreğinde Japonya'da Pocket Monsters: Red & Green sürümleriyle piyasaya sürülmüştür. Aynı yılın son çeyreğinde Pocket Monsters: Blue versiyonunu piyasaya sürdükten sonra Dünya'ya açılmaya karar veren Nintendo, oyunu Kırmızı ve Mavi sürümleri üzerinden diğer ülkelerde yer edinmeye karar vermiştir. İlk önce 1998 yılının üçüncü çeyreğinde Amerika'da, ardından aynı yılın dördüncü çeyreğinde Avustralya'da yerini alan oyunlar, 1999 yılının son çeyreğinde Avrupa'da yaygınlaşmaya başlamıştır. Oyunların Nintendo 3DS ve 2DS konsollarıyla uyumlu sanal sürümleri ise 2016 yılında yayınlanmıştır.

Geliştirici: Game Freak (Japon merkezli bir oyun şirketi) Yayımcı: Nintendo (Japon merkezli bir oyun konsolu) Yapımcı: Shigeru Miyamoto (Japon)

In [21]:
#not: en alttaki deÄŸer max
max_jp = games.sort_values("JP_Sales")
max_jp.tail(10)
Out[21]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
214 215 Monster Hunter Freedom 3 PSP 2010.0 Role-Playing Capcom 0.00 0.00 4.87 0.00 4.87
27 28 Brain Age 2: More Training in Minutes a Day DS 2005.0 Puzzle Nintendo 3.44 5.36 5.32 1.18 15.30
41 42 Animal Crossing: Wild World DS 2005.0 Simulation Nintendo 2.55 3.52 5.33 0.88 12.27
25 26 Pokemon Ruby/Pokemon Sapphire GBA 2002.0 Role-Playing Nintendo 6.06 3.90 5.38 0.50 15.85
26 27 Pokemon Black/Pokemon White DS 2010.0 Role-Playing Nintendo 5.57 3.28 5.65 0.82 15.32
20 21 Pokemon Diamond/Pokemon Pearl DS 2006.0 Role-Playing Nintendo 6.42 4.52 6.04 1.37 18.36
6 7 New Super Mario Bros. DS 2006.0 Platform Nintendo 11.38 9.23 6.50 2.90 30.01
1 2 Super Mario Bros. NES 1985.0 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
12 13 Pokemon Gold/Pokemon Silver GB 1999.0 Role-Playing Nintendo 9.00 6.18 7.20 0.71 23.10
4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37
In [22]:
max_eu = games.sort_values("EU_Sales")
max_eu.tail(10)
Out[22]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
14 15 Wii Fit Plus Wii 2009.0 Sports Nintendo 9.09 8.59 2.53 1.79 22.00
4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37
7 8 Wii Play Wii 2006.0 Misc Nintendo 14.03 9.20 2.93 2.85 29.02
6 7 New Super Mario Bros. DS 2006.0 Platform Nintendo 11.38 9.23 6.50 2.90 30.01
19 20 Brain Age: Train Your Brain in Minutes a Day DS 2005.0 Misc Nintendo 4.75 9.26 4.16 2.05 20.22
16 17 Grand Theft Auto V PS3 2013.0 Action Take-Two Interactive 7.01 9.27 0.97 4.14 21.40
10 11 Nintendogs DS 2005.0 Simulation Nintendo 9.07 11.00 1.93 2.75 24.76
3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
0 1 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
In [23]:
max_na = games.sort_values("NA_Sales")
max_na.tail(10)
Out[23]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
18 19 Super Mario World SNES 1990.0 Platform Nintendo 12.78 3.75 3.54 0.55 20.61
7 8 Wii Play Wii 2006.0 Misc Nintendo 14.03 9.20 2.93 2.85 29.02
8 9 New Super Mario Bros. Wii Wii 2009.0 Platform Nintendo 14.59 7.06 4.70 2.26 28.62
15 16 Kinect Adventures! X360 2010.0 Misc Microsoft Game Studios 14.97 4.94 0.24 1.67 21.82
3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
5 6 Tetris GB 1989.0 Puzzle Nintendo 23.20 2.26 4.22 0.58 30.26
9 10 Duck Hunt NES 1984.0 Shooter Nintendo 26.93 0.63 0.28 0.47 28.31
1 2 Super Mario Bros. NES 1985.0 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
0 1 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
In [24]:
max_other = games.sort_values("Other_Sales")
max_other.tail(10)
Out[24]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
10 11 Nintendogs DS 2005.0 Simulation Nintendo 9.07 11.00 1.93 2.75 24.76
7 8 Wii Play Wii 2006.0 Misc Nintendo 14.03 9.20 2.93 2.85 29.02
6 7 New Super Mario Bros. DS 2006.0 Platform Nintendo 11.38 9.23 6.50 2.90 30.01
348 349 Pro Evolution Soccer 2008 PS2 2007.0 Sports Konami Digital Entertainment 0.05 0.00 0.64 2.93 3.63
3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
16 17 Grand Theft Auto V PS3 2013.0 Action Take-Two Interactive 7.01 9.27 0.97 4.14 21.40
47 48 Gran Turismo 4 PS2 2004.0 Racing Sony Computer Entertainment 3.01 0.01 1.10 7.53 11.66
0 1 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
17 18 Grand Theft Auto: San Andreas PS2 2004.0 Action Take-Two Interactive 9.43 0.40 0.41 10.57 20.81
In [25]:
max_global = games.sort_values("Global_Sales")
max_global.tail(10)
Out[25]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
9 10 Duck Hunt NES 1984.0 Shooter Nintendo 26.93 0.63 0.28 0.47 28.31
8 9 New Super Mario Bros. Wii Wii 2009.0 Platform Nintendo 14.59 7.06 4.70 2.26 28.62
7 8 Wii Play Wii 2006.0 Misc Nintendo 14.03 9.20 2.93 2.85 29.02
6 7 New Super Mario Bros. DS 2006.0 Platform Nintendo 11.38 9.23 6.50 2.90 30.01
5 6 Tetris GB 1989.0 Puzzle Nintendo 23.20 2.26 4.22 0.58 30.26
4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37
3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
1 2 Super Mario Bros. NES 1985.0 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
0 1 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
In [26]:
games[games.Year == games["Year"].max()]
Out[26]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
5957 5959 Imagine: Makeup Artist DS 2020.0 Simulation Ubisoft 0.27 0.0 0.0 0.02 0.29
In [27]:
#NaN satırları siler
games = games.dropna()
sort_year = games.sort_values("Year")
sort_year.tail()
Out[27]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
5288 5290 Star Fox: Zero WiiU 2016.0 Shooter Nintendo 0.16 0.1 0.07 0.03 0.35
14390 14393 Phantasy Star Online 2 Episode 4: Deluxe Package PS4 2017.0 Role-Playing Sega 0.00 0.0 0.03 0.00 0.03
16438 16441 Brothers Conflict: Precious Baby PSV 2017.0 Action Idea Factory 0.00 0.0 0.01 0.00 0.01
16241 16244 Phantasy Star Online 2 Episode 4: Deluxe Package PSV 2017.0 Role-Playing Sega 0.00 0.0 0.01 0.00 0.01
5957 5959 Imagine: Makeup Artist DS 2020.0 Simulation Ubisoft 0.27 0.0 0.00 0.02 0.29
In [28]:
games[games.Year == games["Year"].min()]
Out[28]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
258 259 Asteroids 2600 1980.0 Shooter Atari 4.00 0.26 0.0 0.05 4.31
544 545 Missile Command 2600 1980.0 Shooter Atari 2.56 0.17 0.0 0.03 2.76
1766 1768 Kaboom! 2600 1980.0 Misc Activision 1.07 0.07 0.0 0.01 1.15
1969 1971 Defender 2600 1980.0 Misc Atari 0.99 0.05 0.0 0.01 1.05
2669 2671 Boxing 2600 1980.0 Fighting Activision 0.72 0.04 0.0 0.01 0.77
4025 4027 Ice Hockey 2600 1980.0 Sports Activision 0.46 0.03 0.0 0.01 0.49
5366 5368 Freeway 2600 1980.0 Action Activision 0.32 0.02 0.0 0.00 0.34
6317 6319 Bridge 2600 1980.0 Misc Activision 0.25 0.02 0.0 0.00 0.27
6896 6898 Checkers 2600 1980.0 Misc Atari 0.22 0.01 0.0 0.00 0.24
In [29]:
games[games.Year == 1980].shape
Out[29]:
(9, 11)
In [30]:
games[games.Year == 1981].shape
Out[30]:
(46, 11)
In [31]:
games[games.Year == 1982].shape
Out[31]:
(36, 11)
In [32]:
games[games.Year == 1983].shape
Out[32]:
(17, 11)
In [33]:
games[games.Year == 1984].shape
Out[33]:
(14, 11)
In [34]:
games[games.Year == 1985].shape
Out[34]:
(14, 11)
In [35]:
games[games.Year == 1986].shape
Out[35]:
(21, 11)
In [36]:
games.Genre.value_counts()
Out[36]:
Action          3251
Sports          2304
Misc            1686
Role-Playing    1470
Shooter         1282
Adventure       1274
Racing          1225
Platform         875
Simulation       848
Fighting         836
Strategy         670
Puzzle           570
Name: Genre, dtype: int64
In [37]:
games.Year.value_counts()
Out[37]:
2009.0    1431
2008.0    1428
2010.0    1257
2007.0    1201
2011.0    1136
2006.0    1008
2005.0     936
2002.0     829
2003.0     775
2004.0     744
2012.0     655
2015.0     614
2014.0     580
2013.0     546
2001.0     482
1998.0     379
2000.0     349
2016.0     342
1999.0     338
1997.0     289
1996.0     263
1995.0     219
1994.0     121
1993.0      60
1981.0      46
1992.0      43
1991.0      41
1982.0      36
1986.0      21
1983.0      17
1989.0      17
1990.0      16
1987.0      16
1988.0      15
1985.0      14
1984.0      14
1980.0       9
2017.0       3
2020.0       1
Name: Year, dtype: int64
In [38]:
games.Publisher.value_counts().head(20)
Out[38]:
Electronic Arts                           1339
Activision                                 966
Namco Bandai Games                         928
Ubisoft                                    918
Konami Digital Entertainment               823
THQ                                        712
Nintendo                                   696
Sony Computer Entertainment                682
Sega                                       632
Take-Two Interactive                       412
Capcom                                     376
Atari                                      347
Tecmo Koei                                 338
Square Enix                                231
Warner Bros. Interactive Entertainment     217
Disney Interactive Studios                 214
Eidos Interactive                          196
Midway Games                               196
505 Games                                  192
Microsoft Game Studios                     189
Name: Publisher, dtype: int64
In [39]:
games[games.Publisher == "Electronic Arts"].head(10)
Out[39]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
77 78 FIFA 16 PS4 2015.0 Sports Electronic Arts 1.11 6.06 0.06 1.26 8.49
82 83 FIFA Soccer 13 PS3 2012.0 Action Electronic Arts 1.06 5.05 0.13 2.01 8.24
83 84 The Sims 3 PC 2009.0 Simulation Electronic Arts 0.98 6.42 0.00 0.71 8.11
92 93 Star Wars Battlefront (2015) PS4 2015.0 Shooter Electronic Arts 2.93 3.29 0.22 1.23 7.67
99 100 Battlefield 3 X360 2011.0 Shooter Electronic Arts 4.46 2.13 0.06 0.69 7.34
103 104 Battlefield 3 PS3 2011.0 Shooter Electronic Arts 2.85 2.93 0.35 1.10 7.23
104 105 Need for Speed Underground PS2 2003.0 Racing Electronic Arts 3.27 2.83 0.08 1.02 7.20
112 113 FIFA 14 PS3 2013.0 Sports Electronic Arts 0.78 4.32 0.07 1.73 6.90
113 114 Need for Speed Underground 2 PS2 2004.0 Racing Electronic Arts 2.71 3.02 0.08 1.09 6.90
114 115 Medal of Honor: Frontline PS2 2002.0 Shooter Electronic Arts 2.93 2.75 0.17 0.99 6.83
In [40]:
games.Publisher.value_counts(normalize=True)
Out[40]:
Electronic Arts                 0.082193
Activision                      0.059297
Namco Bandai Games              0.056964
Ubisoft                         0.056350
Konami Digital Entertainment    0.050519
                                  ...   
Ongakukan                       0.000061
Tripwire Interactive            0.000061
Sold Out                        0.000061
Genterprise                     0.000061
WayForward Technologies         0.000061
Name: Publisher, Length: 576, dtype: float64
In [41]:
games[['Publisher','Year']].dtypes
Out[41]:
Publisher     object
Year         float64
dtype: object
In [42]:
games.Year = games.Year.astype('int32')
games.Year.dtypes
C:\Users\asus\anaconda3\lib\site-packages\pandas\core\generic.py:5303: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  self[name] = value
Out[42]:
dtype('int32')
In [43]:
games.isna().any()
Out[43]:
Rank            False
Name            False
Platform        False
Year            False
Genre           False
Publisher       False
NA_Sales        False
EU_Sales        False
JP_Sales        False
Other_Sales     False
Global_Sales    False
dtype: bool
In [44]:
# Muhtemelen tipi string olan kategorileri çekiyor
categorical_df = games.select_dtypes("O")
categorical_df.head()
Out[44]:
Name Platform Genre Publisher
0 Wii Sports Wii Sports Nintendo
1 Super Mario Bros. NES Platform Nintendo
2 Mario Kart Wii Wii Racing Nintendo
3 Wii Sports Resort Wii Sports Nintendo
4 Pokemon Red/Pokemon Blue GB Role-Playing Nintendo
In [45]:
numerical_df  =games.select_dtypes("int", "float")
numerical_df.head()
Out[45]:
Year
0 2006
1 1985
2 2008
3 2009
4 1996
In [46]:
from plotly import graph_objects as go
from plotly import express as px

#I just used this to learn in the plotly library. I will not use this part in the main project

top_10_publisher = games.Publisher.value_counts().head(10)
px.bar(top_10_publisher, title= "Top 10 Video Game Publishers",
      labels={
          "value" : "Number of Games Publishing",
          "index" : "Name of the Publisher"
      })
In [47]:
#I just used this to learn in the plotly library. I will not use this part in the main project

top_10_genres = games.Genre.value_counts()
fig = px.bar(top_10_genres, title="Top 10 Video Game Genres",
            labels={
                "value" : "Number of Games Genres",
                "index" : "Name of the Genre"
            })
fig.show()
fig = px.scatter(top_10_genres, title = "Top Genres Games",
                labels={
                    "value" : "Numbers",
                    "index" : "Genre"
                })
fig.show()
In [48]:
#I just used this to learn in the plotly library. I will not use this part in the main project

top_10_platform = games.Platform.value_counts().sort_values()

fig = px.line(top_10_platform)
fig.show()
In [49]:
#SATIS TOPLAMLARI
#I just used this to learn in the plotly library. I will not use this part in the main project

from plotly.offline import init_notebook_mode, iplot

year_wise_sales = games.loc[:,["Name", "Year", "NA_Sales", "EU_Sales", "JP_Sales", "Other_Sales"]].groupby(by="Year").sum()

fig1 = go.Scatter(x = year_wise_sales.index, y=year_wise_sales["NA_Sales"], name="North America's Sales", line_shape="vh")
fig2 = go.Scatter(x = year_wise_sales.index, y=year_wise_sales["EU_Sales"], name="Europe's Sales", line_shape="vh")
fig3 = go.Scatter(x = year_wise_sales.index, y=year_wise_sales["JP_Sales"], name="Japan's Sales", line_shape="vh")
fig4 = go.Scatter(x = year_wise_sales.index, y=year_wise_sales["Other_Sales"], name="Other Sales", line_shape="vh")

figs = [fig1, fig2, fig3, fig4]
layout = dict(title="Year Wise Totan Game Sales of North America , Europe, Japan and Other Country",
             xaxis = dict(title = "Year"), yaxis=dict(title = "Total Sales In Millions"))
figure=dict(data=figs, layout=layout)
iplot(figure)
In [50]:
#SATIS ORTALAMASI
#I just used this to learn in the plotly library. I will not use this part in the main project

from plotly.offline import init_notebook_mode, iplot

year_wise_sales = games.loc[:,["Name", "Year", "NA_Sales", "EU_Sales", "JP_Sales", "Other_Sales"]].groupby(by="Year").mean()

fig1 = go.Scatter(x = year_wise_sales.index, y=year_wise_sales["NA_Sales"], name="North America's Sales", line_shape="vh")
fig2 = go.Scatter(x = year_wise_sales.index, y=year_wise_sales["EU_Sales"], name="Europe's Sales", line_shape="vh")
fig3 = go.Scatter(x = year_wise_sales.index, y=year_wise_sales["JP_Sales"], name="Japan's Sales", line_shape="vh")
fig4 = go.Scatter(x = year_wise_sales.index, y=year_wise_sales["Other_Sales"], name="Other Sales", line_shape="vh")

figs = [fig1, fig2, fig3, fig4]
layout = dict(title="Year Wise Totan Game Sales of North America , Europe, Japan and Other Country",
             xaxis = dict(title = "Year"), yaxis=dict(title = "Total Sales In Millions"))
figure=dict(data=figs, layout=layout)
iplot(figure)
In [51]:
#I just used this to learn in the plotly library. I will not use this part in the main project

fig = px.scatter(games, x="Year", y="Global_Sales", color="Genre", size="Global_Sales",
                hover_data=["Name"], title="Year Wise Global Video Game Sales by Genre",
                labels={"x": "Years", "y": "Global Sales In Millions"})
fig.show()
In [52]:
#I just used this to learn in the plotly library. I will not use this part in the main project

top_sales = games.sort_values(by=["NA_Sales", "EU_Sales", "JP_Sales", "Other_Sales"], ascending=False).head(10)
top_sales
Out[52]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
0 1 Wii Sports Wii 2006 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
1 2 Super Mario Bros. NES 1985 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
9 10 Duck Hunt NES 1984 Shooter Nintendo 26.93 0.63 0.28 0.47 28.31
5 6 Tetris GB 1989 Puzzle Nintendo 23.20 2.26 4.22 0.58 30.26
2 3 Mario Kart Wii Wii 2008 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
3 4 Wii Sports Resort Wii 2009 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
15 16 Kinect Adventures! X360 2010 Misc Microsoft Game Studios 14.97 4.94 0.24 1.67 21.82
8 9 New Super Mario Bros. Wii Wii 2009 Platform Nintendo 14.59 7.06 4.70 2.26 28.62
7 8 Wii Play Wii 2006 Misc Nintendo 14.03 9.20 2.93 2.85 29.02
18 19 Super Mario World SNES 1990 Platform Nintendo 12.78 3.75 3.54 0.55 20.61
In [64]:
#I just used this to learn in the plotly library. I will not use this part in the main project

dicts_name = {
    "NA_Sales" : "North America Sales (In Millions)",
    "EU_Sales" : "Europe Sales (In Millions)", 
    "JP_Sales" : "Japan_Sales (In Millions)",
    "Other_Sales" : "Other Sales (In Millions)"
}


for(key, title) in dicts_name.items():
    fig = px.sunburst(top_sales, path=["Genre", "Publisher", "Platform"], values=key, title="Top Selling by " + title)
    fig.update_layout(
    grid=dict(columns=2, rows=2),
    margin=dict(t=40, l=2, r=2, b=5))
    fig.show()
In [54]:
games.Genre.value_counts()
Out[54]:
Action          3251
Sports          2304
Misc            1686
Role-Playing    1470
Shooter         1282
Adventure       1274
Racing          1225
Platform         875
Simulation       848
Fighting         836
Strategy         670
Puzzle           570
Name: Genre, dtype: int64
In [55]:
games[games.Name == "Dark Souls"]
Out[55]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
811 813 Dark Souls PS3 2011 Role-Playing Namco Bandai Games 0.75 0.54 0.54 0.23 2.07
2078 2080 Dark Souls X360 2011 Role-Playing Namco Bandai Games 0.64 0.28 0.00 0.08 1.00
11877 11879 Dark Souls PC 2012 Role-Playing Namco Bandai Games 0.00 0.06 0.00 0.01 0.07
In [56]:
games[games.Name == "Resident Evil"]
Out[56]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
201 202 Resident Evil PS 1996 Action Virgin Interactive 2.05 1.16 1.11 0.73 5.05
8442 8444 Resident Evil SAT 1997 Action Capcom 0.00 0.00 0.17 0.00 0.17
9671 9673 Resident Evil PS3 2006 Action Capcom 0.00 0.00 0.12 0.00 0.12
In [57]:
games[games.Name == "Silent Hill"]
Out[57]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
1154 1156 Silent Hill PS 1999 Action Konami Digital Entertainment 0.71 0.48 0.3 0.1 1.6
In [58]:
games[games.Name == "The Elder Scrolls V: Skyrim"]
Out[58]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
75 76 The Elder Scrolls V: Skyrim X360 2011 Role-Playing Bethesda Softworks 5.03 2.86 0.10 0.85 8.84
126 127 The Elder Scrolls V: Skyrim PS3 2011 Role-Playing Bethesda Softworks 2.55 2.71 0.25 1.05 6.56
310 311 The Elder Scrolls V: Skyrim PC 2011 Role-Playing Bethesda Softworks 1.15 2.09 0.00 0.64 3.88
In [59]:
games[games.Name == "Silent Hill"]
Out[59]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
1154 1156 Silent Hill PS 1999 Action Konami Digital Entertainment 0.71 0.48 0.3 0.1 1.6
In [60]:
# games[games.Name == "Red Dead Redemption"]
In [ ]:
 
In [ ]: